package com.logos.cartoon.ui;

import com.formdev.flatlaf.FlatDarkLaf;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.swing.*;
import java.awt.*;

/**
 * @author logos
 * @date 2025/05/23
 */
@Component
public class MainFrame extends JFrame {


    private final LoginFrame loginFrame;

    /**
     * 通过构造器注入服务
     */
    @Autowired
    public MainFrame(LoginFrame loginFrame) {
        this.loginFrame = loginFrame;
        initUI();
        loadData();
    }

    private void initUI() {
        setTitle("二次元角色图鉴");
        setSize(800, 600);
        setDefaultCloseOperation(EXIT_ON_CLOSE);

        // 使用FlatLaf设置日式风格主题
        try {
            UIManager.setLookAndFeel(new FlatDarkLaf());
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        SwingUtilities.updateComponentTreeUI(this);


        // 登录成功后加载数据
        loadData();
    }

    private void loadData() {
    }
}
